﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.TD
{
	public class OdAveBitmap : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdAveBitmap(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdAveBitmap obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdAveBitmap()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdAveBitmap(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public virtual double blendFactor()
		{
			double result = TD_DbPINVOKE.OdAveBitmap_blendFactor(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void source(ref string filename)
		{
			IntPtr intPtr = Marshal.StringToCoTaskMemUni(filename);
			IntPtr value = intPtr;
			try
			{
				TD_DbPINVOKE.OdAveBitmap_source(this.swigCPtr, ref intPtr);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
			}
			finally
			{
				if (intPtr != value)
				{
					filename = Marshal.PtrToStringUni(intPtr);
				}
			}
		}

		public virtual double scaleU()
		{
			double result = TD_DbPINVOKE.OdAveBitmap_scaleU(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual double scaleV()
		{
			double result = TD_DbPINVOKE.OdAveBitmap_scaleV(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual double offsetU()
		{
			double result = TD_DbPINVOKE.OdAveBitmap_offsetU(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual double offsetV()
		{
			double result = TD_DbPINVOKE.OdAveBitmap_offsetV(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual TileMethod tileMethod()
		{
			TileMethod result = (TileMethod)TD_DbPINVOKE.OdAveBitmap_tileMethod(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool useAutoAxis()
		{
			bool result = TD_DbPINVOKE.OdAveBitmap_useAutoAxis(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool fitToObject()
		{
			bool result = TD_DbPINVOKE.OdAveBitmap_fitToObject(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setBlendFactor(double blendFactor)
		{
			TD_DbPINVOKE.OdAveBitmap_setBlendFactor(this.swigCPtr, blendFactor);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setSource(string filename)
		{
			TD_DbPINVOKE.OdAveBitmap_setSource(this.swigCPtr, filename);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setScaleU(double scaleU)
		{
			TD_DbPINVOKE.OdAveBitmap_setScaleU(this.swigCPtr, scaleU);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setScaleV(double scaleV)
		{
			TD_DbPINVOKE.OdAveBitmap_setScaleV(this.swigCPtr, scaleV);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setOffsetU(double offsetU)
		{
			TD_DbPINVOKE.OdAveBitmap_setOffsetU(this.swigCPtr, offsetU);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setOffsetV(double offsetV)
		{
			TD_DbPINVOKE.OdAveBitmap_setOffsetV(this.swigCPtr, offsetV);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setTileMethod(TileMethod tileMethod)
		{
			TD_DbPINVOKE.OdAveBitmap_setTileMethod(this.swigCPtr, (int)tileMethod);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setUseAutoAxis(bool useAutoAxis)
		{
			TD_DbPINVOKE.OdAveBitmap_setUseAutoAxis(this.swigCPtr, useAutoAxis);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setFitToObject(bool fitToObject)
		{
			TD_DbPINVOKE.OdAveBitmap_setFitToObject(this.swigCPtr, fitToObject);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
